import re

import requests
import os



url = 'https://baike.baidu.com/cms/home/eventsOnHistory/10.json?_=1761903736953'
res = requests.get(url)
items = res.json()['10']['1031']
# print(items)
for item in items:
    year = item['year']
    title = item['title']
    title = re.sub(r'<a target="_blank" href=".*?">', '', title)
    title = re.sub(r'</a>', '', title)
    link = item['link']
    print(year, title, link)

    detail_url = link
    detail_res = requests.get(detail_url)
    